let h = `
<div class="content"><span>@统一阿萨姆：</span>
<p dir="ltr"><strong>职场小小鸟</strong></p>
<blockquote>
<p dir="ltr">才面了 10 分钟，HR 就问我这个问题！说好的压力面呢？说好的行为事件访谈呢？就这样结束啦？于是心灰意冷的我，只问了一句：</p>
<p dir="ltr">「你们厕所在哪？」<strong>&nbsp;</strong></p>
</blockquote>
<hr><p dir="ltr"><strong>八卦风水爱好者</strong></p>
<blockquote>
<p dir="ltr">听到这个提问，我心里一阵酸爽。哈哈终于轮到劳资问问题了。</p>
<p dir="ltr">「我上司是什么星座的呀？火象星座和我最合了！」</p>
<p dir="ltr">「男的女的，喜欢男喜欢女？几岁，结婚了吗？」</p>
<p dir="ltr">「坐在哪个位置？哦，这个方位风水好啊积财的！」</p>
<p dir="ltr">……</p>
</blockquote>
<hr><p dir="ltr"><strong>职场老炮</strong></p>
<blockquote>
<p dir="ltr">谢邀。作为一名资深 xx 从业人员，我见识过的套路比这位 HR 小妹妹走过的路还多。这时候，其实只要轻描淡写地说一句：</p>
<p dir="ltr">「你微信多少？我加下。其他的等周一入职了再问吧，也不是什么重要的问题。」</p>
<p dir="ltr">然后迷之微笑，深藏功与名。</p>
</blockquote>
<hr><p dir="ltr">嫌脑洞还不够大？还是买瓶阿萨姆奶茶，扫描二维码，让周星星和郭采洁的「神回复」助你分分钟脑洞大开，让你笑到失声，笑到癫狂，分分钟 get 满满好心情！</p>
<p dir="ltr"><strong id="docs-internal-guid-e1488b05-3c76-d270-6638-bad9319c3f7e"><a href="http://asm.pec.com.cn/1.do?l=Q5">点这里，听听看</a>。</strong></p>
</div>
`;


// console.log(h);
console.log('\n********************************************************************\n');

// 把html标签替换成markdown标签begin
h = h.replace(/<sup>.*?<\/sup>/g, '$1');
h = h.replace(/<pre><code.*?>([\s\S]*?)<\/code><\/pre>/g, '```\r\n$1\r\n```');
h = h.replace(/<span class="LinkCard-content">.*?<\/span>/g, '');
h = h.replace(/<span class="invisible">.*?<\/span>/g, '');
h = h.replace(/<span class="visible">(.*?)<\/span>/g, '$1');
h = h.replace(/<div class="ZhihuDaily-AuthorLine"><span class="ZhihuDaily-Author">.+?<\/span>/, '@知乎用户');
h = h.replace(/<span class=".*?"><\/span>/, '');
h = h.replace(/<a class="view-more" href=".*?">进入「知乎」查看相关讨论<\/a>/, '');
h = h.replace(/<noscript>(.*?)<\/noscript>/g, '');
h = h.replace(/<blockquote>([\s\S]*?)<\/blockquote>/g, function (item, a) {
  let result = '';
  a = a.split('<br>');
  for (let i = 0; i < a.length; i++) {
    let b = a[i].split('\n');
    for (let j = 0; j < b.length; j++) {
      if (b[j].trim().length > 0) {
        result += '> ' + b[j].trim() + '\r\n';
      }
    }
  }
  return result;
});
h = h.replace(/<ul>([\s\S]*?)<\/ul>/g, function (item, a) {
  return a.replace(/<li>([\s\S]*?)<\/li>/g, function (sub_item, sub_a) {
    return '- ' + sub_a.trim();
  });
});
h = h.replace(/<ol>([\s\S]*?)<\/ol>/g, function (item, a) {
  return a.replace(/<li>([\s\S]*?)<\/li>/g, function (sub_item, sub_a) {
    return '- ' + sub_a.trim();
  });
});
h = h.replace(/<h2 class="question-title">(.+)<\/h2>/, '### $1');
h = h.replace(/> <p.*?>(.+?)<\/p>/g, '> $1');
h = h.replace(/<p.*?>([\s\S]*?)<\/p>/g, '\r\n$1\r\n');
h = h.replace(/<span.*?>(.*?)<\/span>/g, '$1');
h = h.replace(/<figure.*?><img.*?src="(.*?)".*?><\/figure>/g, '\r\n![]($1)\r\n');
h = h.replace(/<img.*?src="(.*?)".*?>/g, '\r\n![]($1)\r\n');
h = h.replace(/<a.*?href="(.*?)".*?>(.*?)<\/a>/g, '[$2]($1)');
h = h.replace(/<b>(.*?)<\/b>/g, '**$1**');
h = h.replace(/<strong><em>\s*(.*?)\s*<\/em><\/strong>/g, ' ***$1*** ');
h = h.replace(/<em>(.*?)<\/em>/g, ' *$1* ');
h = h.replace(/<strong.*?>\s*(.*?)\s*<\/strong>/g, ' **$1** ');
h = h.replace(/<strong.*?>(.*?)<\/strong>/g, '$1');
h = h.replace(/<strong.*?>(.*?)<\/strong>/g, '$1');
h = h.replace(/<br.*?>/g, '\r\n');
h = h.replace(/<h1>(.*?)<\/h1>/g, '### $1');
h = h.replace(/<h2>(.*?)<\/h2>/g, '### $1');
h = h.replace(/<h3>(.*?)<\/h3>/g, '### $1');
h = h.replace(/<u>(.*?)<\/u>/g, '$1');
h = h.replace(/<i>\s*(.*?)\s*<\/i>/g, ' ***$1*** ');
h = h.replace(/<address>(.*?)<\/address>/g, '$1');
h = h.replace(/___/, '\\___');
h = h.replace(/---/, '\\---');

// 以下是去掉无用的内容
h = h.replace(/<hr>/g, '');
h = h.replace(/<div class="meta">[\s\S]*?<\/div>/gim, '');
h = h.replace(/<div class="answer".*?>/, '');
h = h.replace(/<div class="answer".*?>/g, '&nbsp;');
h = h.replace(/<div class="(.*?)".*?>/g, '');
h = h.replace(/<div id="(.*?)">.*?/g, '');
h = h.replace(/<div>/g, '');
h = h.replace(/<\/div>/g, '');
h = h.replace(/<\/span>/g, '');
h = h.replace(/<\/a>/g, '');
h = h.replace(/<figure><\/figure>/g, '');
h = h.replace(/<iframe.*?>.*?<\/iframe>/g, '');
h = h.replace(/<wbr>/g, '');
// 把html标签替换成markdown标签end

console.log(h);





















